public class Alien extends Entity
{
  public boolean isDead;
  private PShape ps;
  
  public Alien(int xpos, int ypos, int atype)
  {
    this.xpos = xpos;
    this.ypos = ypos;
    this.renderSizeX = 40;
    this.renderSizeY = 40;
    
    this.ps = atype == 0
              ? loadShape("alien_vert.svg") 
              : loadShape("alien_bleu.svg");
              
    this.isDead = false;
  }

  public void updatePosition(AnimationContext context)
  {
    if (!isDead)
    {
      xpos += context.AlienSpeed * context.AlienDirection;
  
      if (context.MustShiftAlien)
      {
        ypos += renderSizeY;
      }
    }
  }

  public boolean isOutsideZone()
  {
    return (xpos > width - renderSizeX) || xpos < 0;
  }


  public void display()
  {
    if (!isDead)
    {
      shape(ps, xpos, ypos, renderSizeX, renderSizeY);
    }
  }
}

